#ifndef REGISTERWINDOW_HPP
#define REGISTERWINDOW_HPP

#include <QComboBox>
#include <QLabel>
#include <QLineEdit>
#include <QMainWindow>
#include <QPaintEvent>
#include <QPainter>
#include <QPixmap>
#include <QPushButton>
#include <QString>
#include <QVBoxLayout>

class RegisterWindow : public QMainWindow {
  Q_OBJECT

public:
  explicit RegisterWindow(QWidget *parent = nullptr);
  ~RegisterWindow();

protected:
  void paintEvent(QPaintEvent *event) override; // 添加绘制事件以支持圆角窗口

private slots:
  void onRegisterButtonClicked();
  void onBackToLoginClicked();

private:
  QWidget *centralWidget;
  QVBoxLayout *mainLayout;

  QPixmap backgroundImage; // 背景图片属性

  QLabel *titleLabel;
  QLabel *subtitleLabel;

  QLineEdit *userNameEdit;
  QLineEdit *phoneEdit;
  QLineEdit *emailEdit;
  QLineEdit *passwordEdit;
  QLineEdit *confirmPasswordEdit;
  QComboBox *provinceComboBox;
  QLineEdit *pointsEdit;
  QComboBox *majorComboBox;

  QPushButton *registerButton;
  QPushButton *backToLoginButton;

  void setupUI();
  void setupConnections();
  bool validateInput();
  void populateProvinces();
  void populateMajors();
};

#endif // REGISTERWINDOW_HPP